<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>16. 搜索案例--computed</title>
        <!-- 引入Vue -->
        <script src="../js/vue.js"></script>
    </head>
    <body>
        <!-- 准备好一个容器-->
        <div id="app">
            <input type="text" v-model="str">
            <ul>
                <li v-for="(item,index) in newarr" :key="index">{{item}}</li>
            </ul>
        </div>
    </body>

    <script>
        new Vue({
            el:"#app",
            data:{
                str:"",
                arr:["王宁","倩倩","马鹏博","马梦婷","王凡","王一凡"]
            },
            computed:{
                newarr(){
                    return this.arr.filter(item =>item.includes(this.str))
                }
            }
        })
    </script>
</html>